import 'dart:io';

import 'package:cookie_jar/cookie_jar.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter_common_app/env/env_config.dart';
import 'package:flutter_common_app/utils/user_util.dart';
import 'package:path_provider/path_provider.dart';


class HttpUtil {
  static const String MethodGet = "GET";
  static const String MethodPost = "POST";
  static const String dev_url = 'http://localhost:3000';
  static const String test_url = 'http://localhost:3000';
  static const String prod_url = 'http://localhost:3000';

  static String getBaseUrl() {
    String url = '';
    switch (EnvConfig.instance.env) {
      case Env.DEV:
        url = dev_url;
        break;
      case Env.TEST:
        url = test_url;
        break;
      case Env.PROD:
        url = prod_url;
        break;
    }
    return url;
  }

  static getRequestParams(BuildContext context,Map<String,dynamic> requestParams){
    requestParams['timestamp'] = DateTime.now().millisecondsSinceEpoch;
    requestParams['cookie'] = Uri.encodeComponent(UserUtil.getCookie(context));
  }

}
